package cn.zhz.gen;

import cn.zhz.gen.base.BasePo;
import cn.zhz.gen.base.PageParam;
import cn.zhz.gen.base.R;
import cn.zhz.gen.core.FastControllerConfig;
import cn.zhz.gen.core.FastGlobalConfig;
import cn.zhz.gen.core.FastModelConfig;
import cn.zhz.gen.core.FastGenerator;

/**
 * @author ZHZ
 * @date 2022-11-04
 * @apiNote
 */
public class Gen {

    private static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/cloud_dev?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true";
    private static final String DB_USERNAME = "root";
    private static final String DB_PASSWORD = "root";
    private static final String PACKAGE_PARENT = "cn.zhz.gen";
    private static final String PROJECT_BASE_DIR = System.getProperty("user.dir");

    public static void main(String[] args) throws NoSuchMethodException {

        FastGenerator.create(DB_URL, DB_USERNAME, DB_PASSWORD)
                .globalConfig(FastGlobalConfig.create()
                        .author("ZHZ")
                        .moduleName("gen")
                        .packageParent(PACKAGE_PARENT)

                )
                .controllerConfig(FastControllerConfig.create()
                        .resultSuccessMethod(R.class, R.class.getMethod("ok"))
                )
                .modelConfig(FastModelConfig.create()
//                        .pageNoProperty("no")
//                        .pageParamClass(PageParam.class)
                        .basePoClass(BasePo.class)
                )
                .outputDir(System.getProperty("user.dir"))
                .tableNames("auth_user")
                .tablePrefix("auth_")
                .run();

    }

}
